package pta;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author tmh
 * @date 2024/12/18 20:10
 * @description
 */
public class T6_43实现所有功能总工资 {
    public static void main(String[] args) {
        WorkerList app = new WorkerList();
        List<Worker> list = app.constructWorkerList();
        System.out.print(app.computeTotalSalary(list));
    }
}

class WorkerList {
    private Scanner scanner = new Scanner(System.in);

    public Worker readInWorker() {
        String name = scanner.next();
        int age = scanner.nextInt();
        return new Worker(name, age);
    }

    public List<Worker> constructWorkerList() {
        int count = scanner.nextInt();
        List<Worker> list = new ArrayList<>();
        while (count > 0) {
            Worker worker = readInWorker();
            list.add(worker);
            count--;
        }
        return list;
    }

    public double computeTotalSalary(List<Worker> workers) {
        double sum = 0.0;
        for (Worker worker : workers) {
            sum += worker.getSalary();
        }
        return sum;
    }
}

class Worker {
    private String name;
    private double salary;

    public Worker() {
    }

    public Worker(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public String toString() {
        return name + " " + salary;
    }
}
